package com.aofeng.hybrid.service;

import android.content.Context;
import org.json.JSONObject;
import java.util.HashMap;

/**
 * 通用服务超类
 * Created by LGY on 2016-07-04.
 */

public abstract class GenericService {
    protected Context context;
    protected HashMap<String, Object> services = new HashMap<String, Object>();

    public GenericService(Context context) {
        this.context = context;
    }

    public void addService(String key, Object service) {
        services.put(key, service);
    }

    /**
     * 返回json对象
     * @param json
     * @return 格式: {code:200|500,data:{}|[]|primitive}
     * @throws Exception
     */
    abstract public JSONObject action(JSONObject json);
}
